using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Publishing.WebControls;
using Microsoft.SharePoint.Utilities;

namespace LanguageConfigurationSolution
{
    public partial class LanguageConfigurationListSelector : System.Web.UI.UserControl
    {
        protected AssetUrlSelector AssetUrlSelector1;


        public string LanguageConfigurationList
        {
            get
            {
                EnsureChildControls();
                try
                {
                    SPList list = SPContext.Current.Site.RootWeb.GetList(AssetUrlSelector1.AssetUrl);
                    return list.RootFolder.Url;
                }
                catch
                {
                    return null;
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (SPContext.Current != null)
                {
                    string url = SPContext.Current.Site.RootWeb.Properties["LanguageConfigurationList"];
                    if (!string.IsNullOrEmpty(url))
                    {
                        url = SPUrlUtility.CombineUrl(SPContext.Current.Site.ServerRelativeUrl, url);
                    }
                    AssetUrlSelector1.AssetUrl = url;
                    AssetUrlSelector1.DefaultOpenLocationUrl = SPContext.Current.Site.ServerRelativeUrl;
                }
            }
        }


    }
}